<?php

use app\common\services\StaticServices;
use yii\helpers\Url;

?>

<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/tab_member.php', ['tab' => 'give']) ?>
<div class="ui equal width grid">
  <div class="column">
    <div class="panel">
      <div class="panel-alone-content">
        <form class="ui form">
          <div class="field">
            <label>会员名称:</label>
            <input type="text" name="member-name" placeholder="不能少于3个字"
                   value="<?= isset($info['member_name']) ? $info['member_name'] : '' ?>" disabled>
          </div>
          <div class="field">
            <label>会员电话:</label>
            <input type="text" name="member-phone" placeholder=""
                   value="<?= isset($info['member_phone']) ? $info['member_phone'] : '' ?>" disabled>
          </div>
          <div class="field">
            <label>积分来源:</label>
            <div class="ui selection dropdown _dropdown" tabindex="0">
              <input type="hidden" name="integral" value="">
              <i class="dropdown icon"></i>
              <div class="default text"> 请选择类型</div>
              <div class="menu transition hidden" tabindex="-1">
                <?php foreach (StaticServices::getIntegral() as $key => $item): ?>
                  <div class="item" data-value="<?= $key ?>"><?= $key ?></div>
                <?php endforeach; ?>
              </div>
            </div>
          </div>

          <div class="field member_integral" style="display: none;">
            <label>手动给与:</label>
            <input type="number" name="member-integral" placeholder="" value="">
          </div>

          <input type="hidden" name="_csrf" id='csrf' value="<?= Yii::$app->request->csrfToken ?>">
          <input type="hidden" name="member-id" value="<?= isset($info['id']) ? $info['id'] : 0 ?>">
          <input type="hidden" name="give-integral" value="">
          <button class="ui green basic button member-give  " type="button">给与积分</button>
        </form>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
  require(['modules/member/give'], function (give) {
    give.member_down("dropdown");
    give.member_give()
  });
</script>